package general.view 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import morn.core.components.BitmapText;
	import vo.GeneralVO;
	
	/**
	 * ...
	 * @author WLDragon 2014-03-28
	 */
	public class GeneralHead extends Sprite 
	{
		
		public function GeneralHead(tx:int = 35,ty:int = 15) 
		{
			this.x = tx;
			this.y = ty;
			
			head = new Bitmap();
			addChild(head);
			
			generalName = new BitmapText();
			generalName.y = 82;
			addChild(generalName);
		}
		
		public function update(g:GeneralVO):void
		{
			generalName.text = g.name;
			var bmd:BitmapData = App.asset.getBitmapData("jpg.heads." + g.head);
			if(bmd == null)
				head.bitmapData = App.asset.getBitmapData("jpg.heads.default");
			else
				head.bitmapData = bmd;
		}

		private var head:Bitmap;
		private var generalName:BitmapText;
	}

}